package model;

import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;

public abstract class Item
{
    public enum Status
    {
        AVAILABLE,
        UNAVAILABLE
    }

    private final SimpleStringProperty itemCode;
    private final SimpleIntegerProperty quantityInHand;
    private final SimpleDoubleProperty costPrice;
    private final SimpleDoubleProperty sellingPrice;
    private Status status;
    private final SimpleIntegerProperty discount;

    protected Item()
    {
        itemCode = new SimpleStringProperty("N/A");
        quantityInHand = new SimpleIntegerProperty(0);
        costPrice = new SimpleDoubleProperty(0);
        sellingPrice = new SimpleDoubleProperty(0);
        status = Status.AVAILABLE;
        discount = new SimpleIntegerProperty(0);
    }

    protected Item(String itmCode, int qty, double costPrc, double sellPrc, Status status, int dis)
    {
        this.itemCode = new SimpleStringProperty(itmCode);
        this.quantityInHand = new SimpleIntegerProperty(qty);
        this.costPrice = new SimpleDoubleProperty(costPrc);
        this.sellingPrice = new SimpleDoubleProperty(sellPrc);
        this.status = status;
        this.discount = new SimpleIntegerProperty(dis);
    }

    protected Item(Item item)
    {
        this.itemCode = item.itemCode;
        this.quantityInHand = item.quantityInHand;
        this.costPrice = item.costPrice;
        this.sellingPrice = item.sellingPrice;
        this.status = item.status;
        this.discount = item.discount;
    }

    public String getItemCode()
    {
        return itemCode.get();
    }

    public void setItemCode(String itmCode)
    {
        itemCode.set(itmCode);
    }

    public int getQuantityInHand()
    {
        return quantityInHand.get();
    }

    public void setQuantityInHand(int qty)
    {
        quantityInHand.set(qty); 
    }

    public double getCostPrice()
    {
        return costPrice.get();
    }

    public void setCostPrice(double costPrc)
    {
        costPrice.set(costPrc);
    }

    public double getSellingPrice()
    {
        return sellingPrice.get();
    }

    public void setSellingPrice(double sellPrc)
    {
        sellingPrice.set(sellPrc);
    }

    public Status getStatus()
    {
        return status;
    }

    public void setStatus(Status status)
    {
        this.status = status;
    }

    public int getDiscount()
    {
        return discount.get();
    }

    public void setDiscount(int dis)
    {
        discount.set(dis);
    }
}